#version 300 es                        
layout(location = 0) in vec3 a_position;
layout(location = 1) in vec3 a_color;
layout(location = 2) in vec3 a_dirvector;
layout(location = 3) in float a_starttime;

uniform mat4 u_matrix;
uniform float u_curtime;

out vec3 color;
out float elapsedtime;

void main()                            
{
	color = a_color;
	elapsedtime = u_curtime - a_starttime;

	vec3 curpos = a_position + a_dirvector * elapsedtime;
	float gravityfactor = elapsedtime * elapsedtime / 8.0;
	curpos.y -= gravityfactor;

	gl_Position = u_matrix * vec4(curpos, 1.0);
	gl_PointSize = 25.0;
}
